<template>
  <el-container>
    <el-header>
      <Header />
    </el-header>
    <el-container>
      <el-aside width="200px" class="aside">
        <Aside />
      </el-aside>
      <el-container>
        <el-main>
          <router-view></router-view>
        </el-main>
        <el-footer>
          <Footer></Footer>
        </el-footer>
      </el-container>
    </el-container>
  </el-container>
</template>

<script>
import Header from "../components/Header.vue";
import Aside from "../components/Aside.vue";
import Footer from "../components/Footer.vue";
import { getUsername } from "../utils";
//
export default {
  name: "Admin",
  components: {
    Header,
    Aside,
    Footer,
  },
  // mounted
  mounted() {
    if (!getUsername()) {
      // 用户未登录
      this.$message.error("你未登录，请先登录");
      this.$router.replace("/login");
    }
  },
};
</script>

<style>
.aside {
  height: 730px;
  background-color: #545c64;
}
</style>